<template>

    <div id="app">
      <keep-alive exclude="Blog">
        <router-view/>
      </keep-alive>
<!--      <aplayer :audio="audio" :lrcType="1" fixed />-->
    </div>

</template>

<script>
export default{
    provide(){
      return {
        reload: this.reload,
      }
    },
    data() {
      return {
        texTitle: "JJY_BLOG",
        isRouterAlive:true,
        viewCount:0, //访问量
        showPage: '',//判断用户工具
        audio: [
          {
            name: "我的快乐时代",
            artist: "陈奕迅",
            url:
                "http://www.pghhh.top/firstpicture/wdklsd.mp3",
            cover: 'http://r.photo.store.qq.com/psc?/V518IhTc1ak1tt3yl2dJ2vkXwd4UwPld/45NBuzDIW489QBoVep5mceFnspUQEJ3HI2k1qsHt1ZgLIRnZsRZOS6r6W0.ioz6*.8wmm.Vum1wZ3S3OxoC3ycG33qVtZXpK08q8yHYNG3k!/r', // prettier-ignore
            lrc:"",
          },
          {
            name: "我杯茶",
            artist: "陈奕迅",
            url:
                "http://www.pghhh.top/firstpicture/wbc.mp3",
            cover: 'http://r.photo.store.qq.com/psc?/V518IhTc1ak1tt3yl2dJ2vkXwd4UwPld/45NBuzDIW489QBoVep5mceFnspUQEJ3HI2k1qsHt1ZgLIRnZsRZOS6r6W0.ioz6*.8wmm.Vum1wZ3S3OxoC3ycG33qVtZXpK08q8yHYNG3k!/r', // prettier-ignore
            lrc:"",
          },
          {
            name: "以父之名",
            artist: "周杰伦",
            url:
                "http://www.pghhh.top/firstpicture/yfzm.mp3",
            cover: 'http://r.photo.store.qq.com/psc?/V518IhTc1ak1tt3yl2dJ2vkXwd4UwPld/45NBuzDIW489QBoVep5mcWM3xF68Z4J7ok7rWdHoz8CRaLzGIv9gJStT8oHObRTtTNyVRyYg0R8KG76QTVePh9NLrpe5z59sPZeEE3RVY2E!/r', // prettier-ignore
            lrc:""
          },
          {
            name: "黄金时代",
            artist: "陈奕迅",
            url:
                "http://www.pghhh.top/firstpicture/hjsd.mp3",
            cover: 'http://r.photo.store.qq.com/psc?/V518IhTc1ak1tt3yl2dJ2vkXwd4UwPld/45NBuzDIW489QBoVep5mceFnspUQEJ3HI2k1qsHt1ZgLIRnZsRZOS6r6W0.ioz6*.8wmm.Vum1wZ3S3OxoC3ycG33qVtZXpK08q8yHYNG3k!/r', // prettier-ignore
            lrc: "",
          },
          {
            name: "明日旅程",
            artist: "Pandora樂隊",
            url:
                "http://www.pghhh.top/firstpicture/mrlc.mp3",
            cover: 'http://r.photo.store.qq.com/psc?/V518IhTc1ak1tt3yl2dJ2vkXwd4UwPld/45NBuzDIW489QBoVep5mcTpfcZF*85m9dFZQdm1B*PVAhbdHAbGp461Yki*VpY3SDboON7qS3sBAFM7uii7NihScdTEMd7Jrij3cZ6gVPGI!/r', // prettier-ignore
            lrc: "",
          },
          {
            name: "玛利奥派对",
            artist: "陈奕迅",
            url:
                "http://www.pghhh.top/firstpicture/mlapd.mp3",
            cover: 'http://r.photo.store.qq.com/psc?/V518IhTc1ak1tt3yl2dJ2vkXwd4UwPld/45NBuzDIW489QBoVep5mceFnspUQEJ3HI2k1qsHt1ZgLIRnZsRZOS6r6W0.ioz6*.8wmm.Vum1wZ3S3OxoC3ycG33qVtZXpK08q8yHYNG3k!/r', // prettier-ignore
            lrc: "",
          },
        ],
      }
    },

    mounted(){
      this.getviewCount()
    },

    methods: {
      //获取用户使用的是pc端还是移动端
      // _isMobile () {
      //   const flag = navigator.userAgent.match(
      //       /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
      //   )
      //   // const flag = 1
      //   return flag
      // },


      //获取访问量
      getviewCount(){
        var _this = this
        this.axios.get('/blog/getViewCount').then(resp=>{
          // console.log(resp)
          // _this.blogCount = resp.data.obj.blogCount
          _this.viewCount = resp.data
          this.changeviewCountFun(resp.data)
        }).catch((error) => { //捕获异常
          // console.log(error)
        })
      },
      //给store中访问量viewCount的赋值
      changeviewCountFun(viewCount){
        this.$store.dispatch("changeviewCountFun",viewCount)
      },
      reload(){
        this.isRouterAlive = false
        this.$nextTick(function(){
          this.isRouterAlive = true
        })
      }
    },
  }
</script>

<style>
  #app{
    background:url(./assets/image/home2.jpg) no-repeat;
    background-size:cover;
    background-attachment: fixed;
    height: 100%;
  }
  * {
  text-decoration: none;
}
</style>
